/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package config;

import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Random;
import java.util.Set;
import share.AMFBuilder;
import share.PGHelper;

/**
 *
 * @author Salm
 */
public class CFRandomInRangePrize implements JSONable {
    
    private final Map<String, Object> prize = new HashMap();
    private final Random randomer;
    
    CFRandomInRangePrize()
    {
        this.randomer = PGHelper.randomizer();
    }

    public CFRandomInRangePrize(Random randomer) {
        this.randomer = randomer;
    }

    @Override
    public void deser(Map<String, Object> json) {
        if (json.containsKey("prize"))
        {
            prize.putAll((Map) json.get("prize"));
        }
        prize.putAll(json);
    }

    public Map<String, Object> randomPrize() {
        return (Map) MapProcessor.minMaxRandom(randomer, prize);
    }
}
